/* 该文件专门用于创建reducer，用于加工、初始化状态 */
import {JIA,JIAN} from './constant'

const initState = 0 //初识值

export default function reducer (preState=initState,action){
	console.log('--reducer--')
	//获取type,data
	const {type,data} = action
	switch (type) {
		case JIA:
			return preState + data
		case JIAN:
			return preState - data
		default:
			return preState
	}
}